package wibrst.keyboard {
	/**
	 * ...
	 * @author wibrst@qq.com
	 */
	public class KeyConst {
		
		static public const PLUS_SIGN:int = 187;
		
		static public const MINUS_SIGN:int = 189;
		
		static public const PAUSE:int = 19;
		
		static public const STAD_0:int = 48;
		
		static public const STAD_A:int = 65;
		
		static public function getKeyCodeOfNum( nNum:int ):int {
			//trace( "[KeyConst] getKeyCodeOfNum:", nKeyTgt );
			return STAD_0 + nNum;
		}
		
		static public function getNumOfKeyCode( iKeyCode:int ):int {
			return iKeyCode - STAD_0;
		}
		
		static public function getKeyCodeOfChar( sChar:String ):Number {
			if ( ! sChar || ! sChar.length ) {
				throw new Error( "you pass a invalid char !!!" );
			}else if ( sChar.length > 1 ) {
				sChar = sChar.charAt(0);
			}
			var nKeyTgt:int = STAD_A + ( sChar as String ).toUpperCase().charCodeAt() - "A".charCodeAt();
			//trace( "[KeyConst] getKeyCodeOfChar:", nKeyTgt );
			return nKeyTgt;
		}
		
	}

}